<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTableGoodsSkus extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods_skus', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('goods_id')->index()->comment('产品ID');
            $table->string('name', 255)->nullable()->comment('货品名称');
            $table->string('attr_key', 255)->index()->comment('销售属性标识 - 链接，按小到大排序');
            $table->text('image')->nullable()->comment('图片');
            $table->float('price', 8, 2)->default('0.00')->comment('商品价格');
            $table->float('cost_price', 8, 2)->default('0.00')->comment('成本价格');
            $table->float('line_price', 8, 2)->default('0.00')->comment('划线价格');
            $table->string('code', 255)->nullable()->comment('编码');
            $table->integer('sold_num')->default(0)->comment('销量');
            $table->tinyInteger('status')->default(1)->comment('状态 1:enable, 0:disable, -1:deleted');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods_skus');
    }
}
